package com.hyopt.modules.app.controller;

import com.hyopt.common.utils.R;
import com.hyopt.modules.app.service.DefenceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * @ClassName AppDefenceController
 * @Description TODO 防区和点位信息相关接口
 * @Author yangjun
 * @date 2020/1/3 9:57
 * @Version 1.0
 **/
@RestController
@RequestMapping("/app/defence")
@Api(value = "AppDefenceController", tags = {"防区信息相关接口"})
@Slf4j
public class AppDefenceController {

    @Autowired
    private DefenceService defenceService;

    @GetMapping("/all")
    @ApiOperation("获取所有防区的信息")
    public R findAllDefenceInfo(@RequestParam(required = false) Integer id){
        List list=defenceService.getAllDefenceInfo(id);
        return R.ok().put("data",list);
    }

    @GetMapping("/{id}")
    @ApiOperation("获取用户所有的防区的信息")
    public R findDefenceInfoById(@PathVariable Integer id){
        List list=defenceService.findDefenceInfoById(id);
        return R.ok().put("data",list);
    }
}
